package com.itheima.day07_Object_oriented_fundamentals;

public class Student {
    String name; // 姓名
    double chinese; // 语文
    double math; // 数学

    double score; // 成绩

    private int age;

    public void printTotalScore(){
        System.out.println(name + "的总分是：" + (chinese + math));
    }
    public void printAverageScore(){
        System.out.println(name + "的平均分是：" + ((chinese + math) / 2));
    }
    public void printThis(){
        System.out.println(this);
    }
    public void printPass(double score){
        if (this.score > score){
            System.out.println(name + "通过");
        }else {
            System.out.println(name + "不通过");
        }
    }
    public Student(){
        System.out.println("无参构造方法");
    }
    public Student(String name, double chinese, double math){
        this.name = name;
        this.chinese = chinese;
        this.math = math;
        System.out.println("有参构造方法");
    }

    public Student(String name, double chinese, double math, double score, int age) {
        this.name = name;
        this.chinese = chinese;
        this.math = math;
        this.score = score;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getChinese() {
        return chinese;
    }

    public void setChinese(double chinese) {
        this.chinese = chinese;
    }

    public double getMath() {
        return math;
    }

    public void setMath(double math) {
        this.math = math;
    }

    public double getScore() {
        return score;
    }

    public void setScore(double score) {
        this.score = score;
    }

    public void setAge(int age){
        if (age >= 0 && age <= 120){
            this.age = age;
        }else {
            System.out.println("年龄不合法");
        }
    }
    public int getAge(){
        return age;
    }
}
